package info.qingshui.browser.hk.setting;

/**
 * 
 * 更新配置的信息
 *
 */
public class UpdateFileInfo implements  java.io.Serializable{
	
	private static final long serialVersionUID = 4672566388561029184L;
	
	private static int UPDATE_TIMELIMIT = 3;//更新次数
	private static String FILE_TYPE_TEXT = "txt";
	private static String FILE_TYPE_BIN = "bin";
	
	private String fileName ;//本地文件名
	private String updateURL;//更新该文件的URL
	private String type;//文件类型
	private int updateRetryTimes = 0;//已经更新的次数
	private boolean updated;//已经更新
	
	public boolean isText() {
		return FILE_TYPE_TEXT.equals( type );
	}
	
	public boolean isBin() {
		return FILE_TYPE_BIN.equals( type );
	}
	
	/**
	 * 是否到达更新次数限制
	 * @return
	 */
	public boolean isTimeLimit() {
		return this.updateRetryTimes >= UPDATE_TIMELIMIT;
	}
	
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public String getUpdateURL() {
		return updateURL;
	}
	public void setUpdateURL(String updateURL) {
		this.updateURL = updateURL;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public int getUpdateRetryTimes() {
		return updateRetryTimes;
	}
	public void setUpdateRetryTimes(int updateRetryTimes) {
		this.updateRetryTimes = updateRetryTimes;
	}

	public boolean isUpdated() {
		return updated;
	}

	public void setUpdated(boolean updated) {
		this.updated = updated;
	}
	
	public String toString() {
		return "UpdateFileInfo{fileName=" + fileName
				+ ";updateURL=" + updateURL
				+ ";type=" + type
				+ ";updateRetryTimes=" + updateRetryTimes
				+ ";updated=" + updated + "}";
	}
}
